package com.safebox.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateTimeUtils {
    /**
     * Get the string format specified, according to format "MM-dd HH:mm"
     * 
     * @param millis The time to convert
     * @return The target string
     */
    public static String getDateTime() {
        long curTime = System.currentTimeMillis();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
        return simpleDateFormat.format(new Date(curTime));
    }
    
    public static String getTime(long millis) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
        return simpleDateFormat.format(new Date(millis));
    }
}
